package com.gyms.view;

import android.content.Context;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.AbsoluteSizeSpan;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TextView;

import com.gyms.R;
import com.zhy.autolayout.AutoLinearLayout;

/**
 * 确认支付的Item yjl
 */

public class ItemOrderView extends AutoLinearLayout {

    private TextView onePrise;

    public ItemOrderView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.item_confirm_time, this);

        initView();
    }

    private void initView() {
        onePrise=(TextView)findViewById(R.id.tv_one_prise);
        setTextView("10");
    }

    public void setTextView(String prise) {
        prise += "元";
        int end = prise.length();
        Spannable textSpan = new SpannableStringBuilder(prise);
        textSpan.setSpan(new AbsoluteSizeSpan(60), 0, end - 1, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        textSpan.setSpan(new AbsoluteSizeSpan(40), end - 1, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        onePrise.setText(textSpan);
    }
}
